/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author taticay
 */
@Entity
@Table(name = "in_brand")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InBrand.findAll", query = "SELECT i FROM InBrand i"),
    @NamedQuery(name = "InBrand.findByIdBrand", query = "SELECT i FROM InBrand i WHERE i.idBrand = :idBrand"),
    @NamedQuery(name = "InBrand.findByName", query = "SELECT i FROM InBrand i WHERE i.name = :name"),
    @NamedQuery(name = "InBrand.findByDescription", query = "SELECT i FROM InBrand i WHERE i.description = :description"),
    @NamedQuery(name = "InBrand.findByStatus", query = "SELECT i FROM InBrand i WHERE i.status = :status")})
public class InBrand implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_brand")
    private Integer idBrand;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "inBrand")
    private Collection<InLine> inLineCollection;

    public InBrand() {
    }

    public InBrand(Integer idBrand) {
        this.idBrand = idBrand;
    }

    public InBrand(Integer idBrand, String name, String description, boolean status) {
        this.idBrand = idBrand;
        this.name = name;
        this.description = description;
        this.status = status;
    }

    public Integer getIdBrand() {
        return idBrand;
    }

    public void setIdBrand(Integer idBrand) {
        this.idBrand = idBrand;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @XmlTransient
    public Collection<InLine> getInLineCollection() {
        return inLineCollection;
    }

    public void setInLineCollection(Collection<InLine> inLineCollection) {
        this.inLineCollection = inLineCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBrand != null ? idBrand.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InBrand)) {
            return false;
        }
        InBrand other = (InBrand) object;
        if ((this.idBrand == null && other.idBrand != null) || (this.idBrand != null && !this.idBrand.equals(other.idBrand))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InBrand[ idBrand=" + idBrand + " ]";
    }
    
}
